@include('admin.header')
<div class="wrap">
  <div class="margin-bottom-20">
    <a class="btn btn-primary edit"><i class="fa fa-plus"></i> 添加</a>
  </div>
  <form class="form-horizontal js-ajax-form" method="post" novalidate="novalidate">
    <table class="table table-hover table-bordered">
      <thead>
      <tr>
        <th width="100">ID</th>
        <th>系统商品ID</th>
        <th>套餐名称</th>
        <th>利润</th>
        <th>PV</th>
        <th width="120">操作</th>
      </tr>
      </thead>
      <tbody>
      @foreach($data as $v)
      <tr>
        <td>{{$v->id}}</td>
        <td>{{$v->product_id}}</td>
        <td>{{$v->name}}</td>
        <td>{{$v->profit}}</td>
        <td>{{$v->pv}}</td>
        <td><a class="edit" _id="{{$v->id}}">编辑</a>|
          <a class="js-ajax-delete delete" _id="{{$v->id}}">删除</a></td>
      </tr>
        @endforeach
      </tbody>
    </table>
  </form>
</div>

<script>
  $(function(){
  	$('.edit').click(function(){
  		var id = $(this).attr('_id') || 0;
	    open_iframe_layer( '/globalexchange/direct_group_add?id='+id);
    });
  	$('.delete').click(function(){
	    var id = $(this).attr('_id') || 0,$t = $(this);
        _confirm('确认删除？',function(){
        	post('/globalexchange/direct_group_del',{id:id},function(){
        		$t.closest('tr').fadeOut(1000,function(){$(this).remove();});
            });
        });
    });
  });
</script>